﻿using System;

namespace SharpSqlAnalyzer.nodes.mssql
{
	// Token: 0x020003B2 RID: 946
	public class TExecuteAsClause : TParseTreeNode
	{
		// Token: 0x17000881 RID: 2177
		// (get) Token: 0x060026A0 RID: 9888 RVA: 0x0033ABB9 File Offset: 0x00338DB9
		// (set) Token: 0x0600269F RID: 9887 RVA: 0x0033ABB0 File Offset: 0x00338DB0
		public virtual EExecuteAsOption ExecuteAsOption
		{
			get
			{
				return this.executeAsOption;
			}
			set
			{
				this.executeAsOption = value;
			}
		}

		// Token: 0x17000882 RID: 2178
		// (get) Token: 0x060026A2 RID: 9890 RVA: 0x0033ABCA File Offset: 0x00338DCA
		// (set) Token: 0x060026A1 RID: 9889 RVA: 0x0033ABC1 File Offset: 0x00338DC1
		public virtual string UserName
		{
			get
			{
				return this.userName;
			}
			set
			{
				this.userName = value;
			}
		}

		// Token: 0x060026A3 RID: 9891 RVA: 0x0033ABD4 File Offset: 0x00338DD4
		public override void init(object arg1)
		{
			if (arg1 is TSourceToken)
			{
				string text = ((TSourceToken)arg1).ToString();
				if (text.StartsWith("'", StringComparison.Ordinal))
				{
					this.executeAsOption = EExecuteAsOption.eaoString;
					this.userName = text;
					return;
				}
				if (text.Equals("OWNER", StringComparison.CurrentCultureIgnoreCase))
				{
					this.executeAsOption = EExecuteAsOption.eaoOwner;
					return;
				}
				if (text.Equals("CALLER", StringComparison.CurrentCultureIgnoreCase))
				{
					this.executeAsOption = EExecuteAsOption.eaoCaller;
					return;
				}
				if (text.Equals("SELF", StringComparison.CurrentCultureIgnoreCase))
				{
					this.executeAsOption = EExecuteAsOption.eaoSelf;
					return;
				}
				this.executeAsOption = EExecuteAsOption.eaoUser;
				this.userName = text;
			}
		}

		// Token: 0x060026A4 RID: 9892 RVA: 0x0033AC62 File Offset: 0x00338E62
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x060026A5 RID: 9893 RVA: 0x0033AC72 File Offset: 0x00338E72
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x04001D56 RID: 7510
		private EExecuteAsOption executeAsOption;

		// Token: 0x04001D57 RID: 7511
		private string userName;
	}
}
